File code/class/User.php
class Tlf\User
See source code at /code/class/User.php
Constants
Properties
-
public $pdo;user model from sentinel -
static public $cookie_name = 'taeluf_login';The key in $_COOKIE['key'] that the login code is stored in -
public $cookie_expiry = 15552000;Number of seconds before a new cookie expires -
public $registration_expiry = 432000; -
public $password_reset_expiry = 86400; -
public $is_logged_in = false; -
public string $email;email address of user -
public int $id = -1; -
public bool $is_active = false; -
public array $queries = [];Array of query strings identifiable by key. Generated by LilSql (of LilDb package)
Methods
-
public function __construct($pdo) -
public function from_row(array $row)Set values from a database row -
public function is_logged_in():boolreturns true/false whether logged in or not. -
public function set_login_cookie($code)Set the login cookie code viasetcookie()& also set it to$_COOKIE -
public function logout()Change$user->is_logged_into false.setcookie()to delete the cookie. de-activate the cookie key in the database -
public function password_login(string $password)Get a login cookie after validating the password. You must call $this->set_login_cookie($code) to actually send the cookie to the browser. Or thesetcookie()function if you wish to customize it -
public function activate(string $code):boolActivate a user -
public function new_code(string $type): stringGenerate a new cryptographically secure code (& insert into database) -
public function register(string $password) -
public function new_password(string $password, string $code): boolSet a new password on the user. Executes a pdo/mysql UPDATE query. -
public function is_registered():boolChecks if a user has registered for the site -
public function is_active():boolCheck if a user is active (clicked the link in the confirmation email) -
public function security_logs($limit = 100)